set the searchPath to list(gResourcePath & "SCRNPICT\", gResourcePath & "MOOV\", gResourcePath, gResourcePath & "PEOPLE\", gResourcePath & "WISPIC\", gResourcePath & "IVPIC\", gResourcePath & "SOUND\")
if noQT then
alert("QuickTime for Windows 1.1.1 or later is required to use Secrets of STARGATE.")
quit()
end if
set gMovieStartMod to 60
else
set gResourcePath to cdPath & "RESOURCE:"
set the searchPath to list(gResourcePath & "MOOV:", gResourcePath & "SCRNPICT:", gResourcePath, gResourcePath & "PEOPLE:", gResourcePath & "WISPIC:", gResourcePath & "IVPIC:", gResourcePath & "SOUND:")
set gOrigColors to the colorDepth
if gOrigColors <> 8 then
spinCursor()
pause()
set the colorDepth to 8
unLoad(1)
preLoad(1)
updateStage()
continue()
end if
if noQT then
alert("QuickTime 1.6 or later is required to use Secrets of STARGATE.")
quit()
end if
openXLib("STARGATE:RESOURCE:POP_XOBJ")
openXLib("STARGATE:RESOURCE:QTPAL.XOJ")
set gFixPal to FixPalette(mnew, the stageLeft, the stageTop, the stageRight, the stageTop)
set gMovieStartMod to 120
end if
spinCursor()
set the stageColor to 255
set the itemDelimiter to ","
set gSBState to "1," & (the duration of cast "SB.MOV" / 60) - 1
set gIVState to 10
set gPSState to EMPTY
set gMovieState to EMPTY
set gWisdomState to EMPTY
set gPeopleState to EMPTY
set gVideoDouble to 0
updateDoubleIcon()
spinCursor()
set gSysVol to value("200")
updateVolume()
if gOnPC then
set gMusicOn to 0
else
set gMusicOn to 1
end if
set gMusicWasOn to 0
set the hilite of cast "Play Music" to gMusicOn
loadPlayList(1)
set gPlayState to 0
if not gOnPC then
set the volume of sound 1 to integer(gSysVol * 0.39999999999999997)
set the volume of sound 2 to integer(gSysVol * 0.39999999999999997)
end if
set gCursID to 1
set gStageNum to 1
set gSlideDelay to 2
set gPSUserViewed to []
set gMovUserViewed to []
set gMarkedList to []
set gLinkBack to EMPTY
set gLinkBackMap to EMPTY
set gLastPalette to EMPTY
spinCursor()
hidePuppets()
set gPaletteTable to field "Palette Table"
put " " into field "SB_Caption"
put " " into field "Matched IV"
put " " into field "Topic IV"
put " " into field "IV Caption"
spinCursor()
set gPSIndivid2Flag to 0
set the textHeight of field 824 to 16
set the textHeight of field 825 to 14
set the textHeight of field 826 to 16
createPopUps()
resetCursor()
end
on updateDoubleIcon
global gVideoDouble, gResourcePath, gOnPC
if gVideoDouble = 0 then
set fName to "MOV_2X.PIC"
else
set fName to "MOV_1X.PIC"
end if
if gOnPC = 0 then
set the fileName of cast "VideoDouble" to "STARGATE:RESOURCE:SCRNPICT:" & fName
else
set the fileName of cast "VideoDouble" to gResourcePath & "SCRNPICT/" & fName
end if
set the hilite of cast "Double Sized Video" to gVideoDouble
end
on stopMovie
global gOrigColors
if gOrigColors <> the colorDepth then
spinCursor()
set the colorDepth to gOrigColors
updateStage()
end if
end
on readPrefs
global gResourcePath, gMarkedList, gReadObj, gOnPC, gVideoDouble, gSysVol, gMusicOn, gMusicWasOn
spinCursor()
if gOnPC = 1 then
set gReadObj to FileIO(mnew, "?read", "SGP")
else
set gReadObj to FileIO(mnew, "?read", "TEXT")
end if
spinCursor()
if gReadObj = -43 then
exit
else
set allText to gReadObj(mReadFile)
gReadObj(mdispose)
set gMusicWasOn to 0
set vInfo to line 1 of allText
set newMarked to line 2 of allText
set gVideoDouble to line 3 of allText
set gSysVol to line 4 of allText
set gMusicOn to line 5 of allText
set gMarkedList to value(string(newMarked))
updateDoubleIcon()
end if
resetCursor()
end
on writePrefs
global gResourcePath, gMarkedList, gWriteObj, gOnPC, gVideoDouble, gSysVol, gMusicOn
spinCursor()
if gOnPC = 1 then
set gWriteObj to FileIO(mnew, "?write", "SGCDPREF.SGP")
else
set gWriteObj to FileIO(mnew, "?write", "SG User Prefs")
end if
if gWriteObj = -43 then
exit
else
spinCursor()
set allText to "StarGate CD " & the date && the time & RETURN & value(string(gMarkedList)) & RETURN & gVideoDouble & RETURN & gSysVol & RETURN & gMusicOn
gWriteObj(mWriteString, allText)
spinCursor()
gWriteObj(mdispose)
end if
resetCursor()
end
on LineOffset f, t
set t to RETURN & t & RETURN
set o to offset(RETURN & f & RETURN, t)
if o > 0 then
return the number of lines in char 1 to o of t - 1
else
return "0"
end if
end
on ItemOffset f, t
set t to "," & t & ","
set o to offset("," & f & ",", t)
if o > 0 then
return the number of items in char 1 to o of t - 1
else
return "0"
end if
end
on LineItemOffset f, t
set t to RETURN & t & ","
set o to offset(RETURN & f & ",", t)
if o > 0 then
return the number of lines in char 1 to o of t - 1
else
return "0"
end if
end
on wait theTicks
startTimer()
repeat while the timer < theTicks
end repeat
end
on underDev
end
on dissolveEffect
global gOnPC
if gOnPC = 0 then
puppetTransition(50, 0, 20)
end if
end
on LinkTo theDest, theEffect, custPal
global gPaletteTable, gOnPC
spinCursor()
debug(EMPTY)
hidePuppets()
spinCursor()
set the cursor of sprite 4 to 0
set the cursor of sprite 5 to 0
set the cursor of sprite 6 to 0
set the cursor of sprite 7 to 0
set the cursor of sprite 8 to 0
set thisFrame to the frame
if (theDest = EMPTY) or voidp(theDest) then
set theDest to "Start2"
end if
set destFrame to label(theDest)
set thisPal to line thisFrame of gPaletteTable
if (custPal = EMPTY) or voidp(custPal) then
set destPal to line destFrame of gPaletteTable
else
set destPal to the number of cast custPal
end if
if thisPal <> destPal then
dissolveEffect()
puppetPalette(the framePalette)
spinCursor()
go("Black")
spinCursor()
if (destPal = EMPTY) or (destPal = 0) then
puppetPalette("System")
else
if integerp(value(destPal)) then
puppetPalette(value(destPal))
else
puppetPalette(destPal)
end if
end if
updateStage()
puppetPalette(0)
spinCursor()
end if
set the visible of sprite 4 to 1
dissolveEffect()
spinCursor()
set the visible of sprite 31 to 0
if gOnPC then
spinCursor()
unLoad()
end if
go(destFrame)
updatePalette()
spinCursor()
resetCursor()
startMouse()
end
on spinCursor
global gCursID
set gCursID to (gCursID + 1) mod 8
cursor(list(the number of cast ("Watch" & gCursID + 1), the number of cast "Watch Mask"))
end
on putBackChars str
set b to the itemDelimiter
set the itemDelimiter to "~"
set l to item 1 of str
repeat with z = 2 to the number of items in str
put RETURN & item z of str after l
end repeat
set the itemDelimiter to b
return l
end
on resetCursor
cursor(-1)
end
on stopCursor
cursor(list(the number of cast "Stop Cursor", the number of cast "Stop Cursor Mask"))
end
on waitUntilClick
repeat while the mouseUp = 1
end repeat
end
on eatDBLClick
repeat while the mouseUp = 0
end repeat
end
on createPopUps
global xObjSBPop, gOnPC
if gOnPC = 0 then
if objectp(xObjSBPop) then
xObjSBPop(mdispose)
end if
set menuList to the text of cast "SBTXT_PU"
set xObjSBPop to PopMenu(mnew, menuList, 200)
if not objectp(xObjSBPop) then
devAlert("SB PopMenu object not made: " & string(xObjSBPop))
end if
end if
end
on createPeoplePopUps theItem
global xObjPeoplePop, gPeoplePopRecs, gPeoplePop1, gOnPC
if gOnPC = 0 then
if objectp(xObjPeoplePop) then
xObjPeoplePop(mdispose)
end if
set b to the itemDelimiter
set the itemDelimiter to "|"
set gPeoplePop1 to item theItem of field "PEOPLE_P1"
put item theItem of field "PEOPLE_P3", gPeoplePopRecs
set the itemDelimiter to b
set xObjPeoplePop to PopMenu(mnew, gPeoplePop1, 201)
if not objectp(xObjPeoplePop) then
devAlert("People PopMenu object not made: " & string(xObjPeoplePop))
end if
end if
end
on invokePeoplePopUp
global xObjPeoplePop, gPeoplePopRecs, gPeoplePop1, gOnPC
if gOnPC = 0 then
set s to the clickOn
set sx to the left of sprite s + the stageLeft + 1
set sy to the top of sprite s + the stageTop + 1
set result to xObjPeoplePop(mPopText, sx, sy, 0)
spinCursor()
if string(result) = EMPTY then
resetCursor()
exit
else
set l to LineOffset(result, gPeoplePop1)
if l > 0 then
LinkPeopleFromIcon(l)
else
devAlert("People “" & result & "” not found in lookUp table.")
end if
resetCursor()
end if
end if
end
on invokeSBPopUp
global xObjSBPop, gOnPC
if gOnPC = 0 then
set s to the clickOn
set sx to the left of sprite s + the stageLeft + 1
set sy to the top of sprite s + the stageTop + 1
set result to xObjSBPop(mPopText, sx, sy, 0)
spinCursor()
if string(result) = EMPTY then
resetCursor()
exit
else
set l to LineOffset(result, field "SBTXT_PU")
if l > 0 then
updateSB(line l of field "SBTXT_PD")
resetCursor()
else
devAlert("Storyboard “" & result & "” not found in lookUp table.")